//
//  GQProfileMyCollectionCell.m
//  GuQu
//
//  Created by HELIUM STAR on 15/5/27.
//  Copyright (c) 2015年 HELIUM STAR. All rights reserved.
//

#import "GQProfileMyCollectionCell.h"

@interface GQProfileMyCollectionCell ()

@property (strong, nonatomic) UIImageView *imgView;
@property (strong, nonatomic) UILabel *nameLabel;
@property (strong, nonatomic) UILabel *infoLable;
@property (strong, nonatomic) UILabel *flagLabel;
@property (strong, nonatomic) UILabel *timeLabel;

@end

@implementation GQProfileMyCollectionCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setUpChildView];
    }
    return self;
}

- (void)setUpChildView
{
    
    //创建UIImageView
    UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon"]];
    self.imgView = imageView;
    [self addSubview:imageView];
    
    //创建发布人
    UILabel *nameLabel = [[UILabel alloc] init];
    
    nameLabel.font = [UIFont systemFontOfSize:10];
    nameLabel.text = @"古趣资讯";
    nameLabel.textColor = [UIColor blackColor];
    self.nameLabel = nameLabel;
    [self addSubview:nameLabel];
    
    //创建详细信息
    UILabel *infoLable = [[UILabel alloc] init];
    infoLable.font = [UIFont systemFontOfSize:15];
    infoLable.textColor = [UIColor blackColor];
    infoLable.numberOfLines = 0;
    infoLable.text = @"古铜镜的收藏者之我有话要说第三十水电费水电费开始的二期。";
    self.infoLable = infoLable;
    [self addSubview:infoLable];
    
    //创建标签
    UILabel *flagLabel = [[UILabel alloc] init];
    flagLabel.textColor = [UIColor lightGrayColor];
    flagLabel.font = [UIFont systemFontOfSize:12];
    flagLabel.text = @"#陶瓷紫砂#交易买卖";
    self.flagLabel = flagLabel;
    [self addSubview:flagLabel];
    
    //创建时间标签
    UILabel *timeLabel = [[UILabel alloc] init];
    timeLabel.text = @"15/04/12";
    timeLabel.textAlignment = NSTextAlignmentCenter;
    timeLabel.font = [UIFont systemFontOfSize:9];
    timeLabel.textColor = [UIColor blackColor];
    self.timeLabel = timeLabel;
    [self addSubview:timeLabel];
    
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    CGFloat imageWidth = 60;
    CGFloat margin = 10;
    
    self.imgView.x = margin;
    self.imgView.y = 10;
    self.imgView.width = imageWidth;
    self.imgView.height = imageWidth;
    
    self.nameLabel.x = CGRectGetMaxX(self.imgView.frame) + 10;
    self.nameLabel.y = self.imgView.x;
    self.nameLabel.width = 100;
    self.nameLabel.height = 10;
    
    self.infoLable.x = self.nameLabel.x;
    self.infoLable.y = CGRectGetMaxY(self.nameLabel.frame);
    self.infoLable.width = self.width - 85;
    self.infoLable.height = 40;
    
    self.flagLabel.x = self.nameLabel.x;
    self.flagLabel.width = 150;
    self.flagLabel.height = 12;
    self.flagLabel.y = CGRectGetMaxY(self.imgView.frame) - self.flagLabel.height;
    
    self.timeLabel.x = self.width - margin - 45;
    self.timeLabel.width = 45;
    self.timeLabel.height = 9;
    self.timeLabel.y = CGRectGetMaxY(self.imgView.frame) - self.timeLabel.height;
    
}


@end
